package com.lazar.model;

import com.lazar.dao.StudentDao;

import java.util.Date;
import java.util.List;

public class Student {

    public static long getSerialVersionID() {
        return serialVersionID;
    }

    private static final long serialVersionID = 1L;

    private int sid;
    private String name;
    private String sex;
    private Date birth;

    public int getSid() {
        return sid;
    }

    public void setSid(int sid) {
        this.sid = sid;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public Date getBirth() {
        return birth;
    }

    public void setBirth(Date birth) {
        this.birth = birth;
    }

    @Override
    public String toString() {
        return "Student{" +
                "sid=" + sid +
                ", name='" + name + '\'' +
                ", sex='" + sex + '\'' +
                ", birth=" + birth +
                '}';
    }

    public boolean addStudent(){
        StudentDao dao = new StudentDao();
        return dao.addStudent(this);
    }

    public List<Student> listStudent(){
        StudentDao dao = new StudentDao();
        return dao.getAllStudent();
    }
}
